package Com.javaserver.dao;

import Com.javaserver.bean.salary;
import Com.javaserver.utils.DB;

import java.util.List;

public class salaryserver {
        //添加薪资
        public salary saadd(salary s){
            int i=DB.executeUpdate("insert into salary (X_id,X_name,X_month,X_basepay,X_overtimepay,X_expenses,X_attendance,X_absenteeism,X_insurance,X_wages)" +
                    " values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",s.getX_id(),s.getX_name(),s.getX_month(),s.getX_basepay(),s.getX_overtimepay(),s.getX_expenses(),s.getX_attendance(),s.getX_absenteeism(),s.getX_insurance(),s.getX_wages());
            if (i==-1){
                return  null;
            }
            return  s;
        }
    //显示
    public List salist(Integer page){
        List list=DB.executeQuery("select * from salary limit ?, 10", (page - 1) * 10);
        return  list;
    }
    //删除
    public  boolean sadele(salary s){
            String sql="delete from salary where X_id=?";
            int i=DB.executeUpdate(sql,s.getX_id());
            return  1>0;
    }

    //模糊查询
    public  List  likelist(Integer i){
            List list=DB.executeQuery("select * from salary where X_month like '%" + i + "%'");
            return  list;
    }
}
